home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 1
/
Nebula One.iso
/
Utilities
/
Converters
/
Convert_FONT
/
Source
/
shared.subproj
/
RCS
/
testNeXT2Mac.m,v
< prev
next >
Wrap
Text File
|
1995-06-12
|
3KB
|
129 lines
head 1.2;
branch ;
access ;
symbols beta10:1.1;
locks death:1.2;
comment @@;
1.2
date 93.04.04.23.45.39; author death; state Exp;
branches ;
next 1.1;
1.1
date 93.01.10.15.09.03; author death; state Exp;
branches ;
next ;
desc
@@
1.2
log
@Sun Apr 4 23:45:39 PDT 1993
@
text
@#import "NeXTToMacText.h"
#import "common.h"
#import <stdio.h>
void main()
{
Instance converter;
Integer index;
Character theChar, strictChar;
CString source = "Hi there how are you doing?";
ErrorCode errorone, errortwo;
FILE* theFile;
CString result, buffer;
Integer resultsize;
Integer ctr, colctr = 1;
converter = [[NeXTToMacText alloc] init];
//
// Convert an ascii char, an existing 8 bit char, and a characcter we know won't convert
//
theChar = [converter ConvertCharacter: 'A'];
errorone = [converter GetErrorCode];
printf("Character A: %c (bool result: %d)\n", theChar, errorone);
theChar = [converter ConvertCharacter: 0xB6];
errorone = [converter GetErrorCode];
printf("Character paragraph: %c (bool result: %d)\n", theChar, errorone);
theChar = [converter ConvertCharacter: 0xE6];
errorone = [converter GetErrorCode];
printf("Can't convert eth : %c (bool result: %d)\n", theChar, errorone);
for (index = 0; index < 256; index++)
{
theChar = [converter ConvertCharacter: index];
errorone = [converter GetErrorCode];
[converter ConvertSingleQuotes: YES];
strictChar = [converter ConvertCharacter: index];
errortwo = [converter GetErrorCode];
[converter ConvertSingleQuotes: NO];
printf("Converting NeXT 0x%X to Mac 0x%X (%c) (error: %d) [quote mode: 0x%X (%c) (error: %d)]\n",
index,
theChar, theChar, errorone,
strictChar, strictChar, errortwo);
}
// part two.
buffer = NewCString(512);
for (ctr = 0; ctr < 256; ctr++)
{
if (colctr != 16)
{
buffer[ctr*2] = ctr;
buffer[(ctr*2)+1] = ' ';
colctr++;
}
else
{
buffer[ctr*2] = ctr;
buffer[(ctr*2)+1] = '\r';
colctr = 1;
}
}
buffer[512] = EndOfCString;
printf("Source text is: \n%s\n", &buffer[1]); // skip initial null
result =(CString) [converter ConvertString: (Pointer) buffer WithLength: 512];
resultsize = [converter GetIntegerFrom: SECOND_RESULT];
printf("Size of result: %d\n", resultsize);
printf("Results text is: \n");
for (ctr = 0; ctr < resultsize; ctr ++)
printf("%c", result[ctr]);
printf("\n");
// test that it expands its internal buffer alright by giving it some text which we
// know will multiply in size when it comes out. .. convert lots of Thorns
for (ctr = 0; ctr < 16; ctr++)
buffer[ctr] = 0xFC;
buffer[16] = EndOfCString;
printf("Source text is: \n%s\n", (CString)buffer);
result =(CString) [converter ConvertString: (Pointer) buffer WithLength: 16];
resultsize = [converter GetIntegerFrom: SECOND_RESULT];
printf("Size of result: %d\n", resultsize);
printf("Results text is: \n");
for (ctr = 0; ctr < resultsize; ctr ++)
printf("%c", result[ctr]);
printf("\n");
FreeCString(result);
FreeCString(buffer);
close(theFile);
[converter free];
}@
1.1
log
@Sun Jan 10 15:09:03 PST 1993
@
text
@@